package case5_9;

public class case6 {
    public static void main(String[] args) {
        //数组内容相同：设计一个方法，用于比较两个数组的内容是否相同。
        int[] arr1 = {1, 3, 5, 7, 9};
        int[] arr2 = {1, 3, 5, 7, 8};
        int[] arr3 = {1, 3, 5, 7, 9};//{9, 7, 5, 3, 1};
        boolean flag1 = compare(arr1,arr2);
        boolean flag2 = compare(arr1,arr3);
        System.out.println(flag1);
        System.out.println(flag2);
    }

    public static boolean compare(int[] arr1, int[] arr2) {
        if (arr1.length != arr2.length) {
            return false;
        }else {
            for (int i = 0; i < arr1.length; i++) {
                if (arr1[i] != arr2[i]) {
                    return false;
                }
            }
        }
        return true;
    }
}
